// 导入需要的config和request
import confing from '../config/config.js';
import request from '../util/request.js';

// 申明请求对象
const processContentRequest = {
    // dict请求的基本url
    BASE_URL : confing.PRO_URL + "/processContent",
    /**
     * 根据工序编号查询操作步骤
     * @param {*} processId 
     * @param {*} callback 
     */
    list(processId,callback){
    request.get(this.BASE_URL + "/list?processId=" +
    processId,callback);
     },
     save(processContent,callbcak){
        if(processContent){
          request.post(this.BASE_URL + "/save",processContent,callbcak);
        }
      },
     /**
      * 根据ID编辑操作步骤信息
      * @param {*} processContent 
      * @param {*} callback 
      */
  edit(processContent, callback) {
    if (processContent != undefined && processContent.contentId != undefined) {
      request.put(this.BASE_URL + "/update", processContent, callback);
    }
  },
  /**
   * 通过id查询工艺组成信息
   * @param {*} contentId 
   * @param {*} callback 
   */
  get(contentId, callback) {
    if (contentId) {
      let url = this.BASE_URL + "/get?contentId=" + contentId;
      request.get(url, callback);
    }
  },
 /**
  * 根据ID删除操作步骤
  * @param {*} contentId 
  * @param {*} callback 
  */
  delete(contentId, callback) {
    request.delete(this.BASE_URL + "/delete?contentId=" + contentId, callback);
  },
     
    }
    // 将dictRequest暴漏出去
    export default processContentRequest;